using System.Collections;

namespace PsVcs
{
    public class ConferenceManager
    {
        private readonly IList _conferences = new ArrayList();
        private Conference _workingConference;

        public IList Conferences
        {
            get { return _conferences; }
        }

        public Conference WorkingConference
        {
            get { return _workingConference; }
            set { _workingConference = value; }
        }

        public void Add (Conference pConference)
        {
            if (null == pConference) throw new PsVcsException(PsVcsException.ConferenceManagerNullConferenceAdded);
            if (Exists(pConference)) throw new PsVcsException(PsVcsException.ConferenceManagerDuplicateConferenceAdded);
            Conferences.Add(pConference);
            WorkingConference = pConference;
        }

        private bool Exists(Conference pConference)
        {
            return Conferences.Contains(pConference);
        }
    }
}
